//
//  cartTestHarness.c
//  Dominion
//
//  Created by Eric Hook on 2/13/14.
//  Copyright (c) 2014 Eric Hook. All rights reserved.
//

#include "headers.h"

#define NUM_TESTS 2

struct gameState *G;
struct gameState *Gpost;
struct gameState *Gpre;
int i, numPlayers ;
static int cardToTest = village;
;
int seed = 100;

void setUpGameState(){
    G     = malloc(sizeof(struct gameState));
    Gpost = malloc(sizeof(struct gameState));
    Gpre  = malloc(sizeof(struct gameState));
    //srand((int)time(NULL));//time doesn't update fast enough - need fix
    seed = seed + 1;
    gameStateRandomizer(G, seed);
    memcpy (Gpost, G, sizeof(struct gameState));
    memcpy (Gpre,  G, sizeof(struct gameState));
}

void testCardEffect (int testCard, struct gameState *post) { //FORMAT-> int cardEffect_remodel(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus);
    
    int choice1 = 0;
    int choice2 = 0;
    int choice3 = 0;
    int handPos = 0;
    int *bonus  = 0;
    char cardName[20];
    cardNumToName(cardToTest, cardName);
    Gpre->hand[Gpre->whoseTurn][0] = cardToTest;    // Make sure card is in hand to be played tested
    post->hand[post->whoseTurn][0] = cardToTest;    // Make sure card is in hand to be played tested
    // send POST gamestate and compare the changes to PRE gamestate
    cardEffect(cardToTest, choice1, choice2, choice3, post, handPos, bonus);  // call card effect for adventurer with new random game state
    printf ("||||| FINISH Card Effect: %s (%i) \n", cardName,cardToTest);
    printf ("VVVVV \n");
}

int main (int argc, char* argv[]) {

    for (int i = 0; i < NUM_TESTS; i++) {
        setUpGameState();   // create identical randomized game states for pre and post
        cardEffect(cardToTest, 0, 0, 0, G, 0, 0);
        testCardEffect(cardToTest, Gpost);
        showPrePostGameState(Gpost, Gpre);
        printf (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
    }

    return 0;
}

